﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter2.Section6
{
    public class Example05
    {
        public Example05()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Function.ToLastType<double[], double> f
                = new V.Function.ToLastType<double[], double>(func);
            double[] at = { 1.0, 1.0, 1.0 };
            V.TangentPlaneToLevelSurface tp = new V.TangentPlaneToLevelSurface(f,at);
            tp.Parameter1 = 2.0;
            tp.Parameter2 = 3.0;            
            V.Vector x = tp.GetVectorOnPlane();
            result += x[0].ToString() + "    ";
            result += x[1].ToString() + "    ";
            result += x[2].ToString() + "\r\n";
            result += (3.0*x[0] + 3.0*x[1] + 2.0*x[2]).ToString() + "\r\n";
        }
        private double func(double[] x)
        {
            return 3.0 * x[0] * x[1] + x[2] * x[2];
        }
    }
}
// 24.9999999999928    12.9999999999923    -53.0000000000041
// 7.99999999994704


